package com.btb.adapter.mapper;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import com.google.common.collect.Maps;

@Repository
public class UserApiDao {
	@Autowired
	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
	final static String LIST_SQL = "SELECT * FROM `user_api` where sign =:sign";

	public boolean check(String sign) {
		Map<String, Object> param = Maps.newHashMap();
		param.put("sign", sign);
		List<Map<String, Object>> queryForList = namedParameterJdbcTemplate.queryForList(LIST_SQL, param);
		return !queryForList.isEmpty();
	}
}
